﻿package level4.grid_case.grid
{
	/**
	 * 路径中的节点实体
	 * */
	public class Node
	{
		/**Node在Grid中的x,y*/
		public var x:int;
		public var y:int;
		/**总代价*/
		public var f:Number;
		/**开始节点到当前节点的代价*/
		public var g:Number;
		/**当前节点到结束节点的代价*/
		public var h:Number;
		/**默认可以通过*/
		public var walkable:Boolean = true;
		/**上级节点*/
		public var parent:Node;
		/**通过此节点需要花费的代价*/
		public var costMultiplier:Number = 1;
		
		/**可存放附近数据**/
		public var tag:Object;
		
		public function Node(x:int,y:int)
		{
			this.x = x;
			this.y = y;
		}
		public function dispose():void{
			parent = null;
			tag = null;
		}
		public function toString():String{
			return "{x:"+x+",y:"+y+",p:{"+parent+"},c:"+tag.numChildren+"}";
		}
	}
}